package main;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Stub {
	//private Format TraitFormat(Ligne);
	private String ligne;


	public static Format TraitFormat(Format res, String strLineIn){
		
		
		    	if (strLineIn.equals("300 4A A7")){
		    		res=new Format(3,74,167);
		    		res.TabOctetB10[0]=74;
		    		res.TabOctetB10[1]=167;
		    	
		    		return res;
		   
		    	}
		    
		    if (strLineIn.equals("301 12B4")){
		    	res=new Format(2,18,180);
		    	
		    	res.TabOctetB10[0]=18;
	    		res.TabOctetB10[1]=180;
	    	
	    		return res;
	    		
	    		}
		    if (strLineIn.equals("302 C3")){
		    	res=new Format(1);
		    	
		    	res.TabOctetB10[0]=195;
	    		
	    	
	    		return res;
	    		
	    		}
		    if (strLineIn.equals("303 C345dE")){
		    	res=new Format(0);
		    	
		    	
	    	
	    		return res;
	    		
	    		}
		    if (strLineIn.equals("304 A7D1")){
		    	res=new Format(2,167,209);
		    	
	    
	    		res.TabOctetB10[0]=167;
	    		res.TabOctetB10[1]=209;
	    	
	    		return res;
	    		
	    		}
		    res=new Format(4);
			return res;
			
		    }


	public Stub(String inputFile,String outputFile) {
		// TODO Auto-generated method stub
		System.out.println("-------------------------------");
		System.out.println("--------Debut du Stub----------");
		
		System.out.println("-------------------------------");
		
		
		String diff ="";
		try{
		 
			BufferedReader brinput = new BufferedReader(new FileReader(inputFile));
		    BufferedWriter brOutput = new BufferedWriter(new FileWriter(outputFile));
		    String strLineIn;
		   
		    //Read File Line By Line
		    int lineCount = 0;

		    while ((strLineIn = brinput.readLine()) != null){
		    	 String strLineOut="";
		    	System.out.println(strLineIn);
		    	
		    	Format res = null ;
		    	res=/*Stub.*/TraitFormat(res, strLineIn);
		    	System.out.println(res);
		    	if (res.TabOctetB10[1]==0 && res.TabOctetB10[0]==0)
		    		strLineOut+="F"+res.NoFormat;
		    	else{
		    	if (res.TabOctetB10[1]==0)
		    		strLineOut+="F"+res.NoFormat+ " " +res.TabOctetB10[0];
		    	else{
		    		if (res.TabOctetB10[0]==0)
		    			strLineOut+="F"+res.NoFormat+ " " +res.TabOctetB10[1];
		    	}
		    	}
		    	if (res.TabOctetB10[1]!=0 && res.TabOctetB10[0]!=0)
		    	strLineOut+="F"+res.NoFormat+ " " +res.TabOctetB10[0] +" "+res.TabOctetB10[1];
		    	if (res.NoFormat==0)
		    		strLineOut="F"+res.NoFormat+" C345dE";
		    	
		    	if (strLineOut!=null ){
		    	brOutput.write(strLineOut);
		    	brOutput.newLine();
		    	}
		    }
		    brOutput.close();
			    }catch (Exception e){//Catch exception if any
			      System.err.println("Error: " + e.getMessage());
			      diff += "Error: " + e.getMessage()+"\n";
			    }
	
	

}
	}









